package com.nbicc.obs.controller;

import com.nbicc.common.ResponseObj;
import com.nbicc.obs.service.ObsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;

/**
 * @Author: lilingyan
 * @Date 2018/12/24 14:55
 */
@Api(value = "OBS文件管理" , description = "OBS文件管理")
@Validated
@RestController
@RequestMapping("/obs")
public class ObsController {

    @Autowired
    private ObsService obsService;

    @ApiOperation(value = "获得publicBucketURL签名",notes = "公共读，私有写")
    @PutMapping("/sign/public")
    public ResponseObj getPublicBucketSignList(@RequestBody @Valid @NotEmpty List<String> objectKeyList) {
        return ResponseObj.success().setResult(obsService.getPublicBucketSignList(objectKeyList));
    }

}
